import request from '@/config/axios'

export function saveTopicApi(data: SysTopic) {
	return request.post({
		url: '/system/sys-topic/saveTopic',
		data
	})
}

export function deleteTopicApi(id: number) {
	return request.delete({
		url: '/system/sys-topic/deleteTopic/' + id
	})
}

export function toggleTopicClosedApi(data: ToggleTopicClosedRequest) {
	return request.put({
		url: '/system/sys-topic/toggleTopicClosed',
		data
	})
}

export function modifyTopicSortApi(data: ModifyTopicSortRequest) {
	return request.put({
		url: '/system/sys-topic/modifyTopicSort',
		data
	})
}

export function modifyTopicCommentSortApi(data: ModifyTopicCommentSortRequest) {
	return request.put({
		url: '/system/sys-topic/modifyTopicCommentSort',
		data
	})
}

export function saveTopicCommentApi(data: SysTopicComment) {
	return request.post({
		url: '/system/sys-topic/saveTopicComment',
		data
	})
}

export function deleteTopicCommentApi(id: number) {
	return request.delete({
		url: '/system/sys-topic/deleteTopicComment/' + id
	})
}

export function likeTopicApi(data: LikeTopicRequest) {
	return request.post({
		url: '/system/sys-topic/likeTopic',
		data
	})
}

export function cancelLikeTopicApi(data: LikeTopicRequest) {
	return request.post({
		url: '/system/sys-topic/cancelLikeTopic',
		data
	})
}

export function likeCommentApi(data: LikeCommentRequest) {
	return request.post({
		url: '/system/sys-topic/likeComment',
		data
	})
}

export function cancelLikeCommentApi(data: LikeCommentRequest) {
	return request.post({
		url: '/system/sys-topic/cancelLikeComment',
		data
	})
}

export function getLikeCountByTopicIdApi(topicId: number) {
	return request.get({
		url: '/system/sys-topic/readOnly/getLikeCountByTopicId/' + topicId,
	})
}

export function getLikeCountByCommentIdApi(commentId: number) {
	return request.get({
		url: '/system/sys-topic/readOnly/getLikeCountByCommentId/' + commentId,
	})
}
